#include "heard.h"


int enqueue(queue_t *b_queue, int net_fd){
    if(b_queue->size == MAXSIZE){
        return -1;
    }

    b_queue->element[b_queue->rear] = net_fd;
    b_queue->rear = (b_queue->rear+1)%MAXSIZE;
    b_queue->size++;

    return 0;
}

int dequeue(queue_t *b_queue, int *net_fd){
    if(b_queue->size == 0){
        return -1;
    }

    *net_fd = b_queue->element[b_queue->front];
    b_queue->front = (b_queue->front+1)%MAXSIZE;
    b_queue->size--;

    return 0;
}
